package com.example.lt.context;

/**
 * @Author 小涛Tao
 * @Date: 2024/07/29/14:00
 * version 1.0 注释：线程本地变量，用来存储当前登录者的id
 **/
public class BaseContext {

    private static ThreadLocal<Long> userThreadLocal = new ThreadLocal<>();
    // 添加
    public static void set(Object id){
        userThreadLocal.set(Long.valueOf(id.toString()));
    }
    // 获取
    public static Long get(){
        return userThreadLocal.get();
    }
    // 删除
    public static void clear(){
        userThreadLocal.remove();
    }

}
